package com.example.dota2draftsimulator.view;

import com.example.dota2draftsimulator.R;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.TextView;

public class CustomButton extends FrameLayout {

	private FrameLayout fLayout;
	private TextView textViewX;
	
	public CustomButton(Context context) {
		this(context, null);
	}

	public CustomButton(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}
	
	public CustomButton(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		// TODO Auto-generated constructor stub
		Typeface type = Typeface.createFromAsset(context.getAssets(),"OPTIMUSPRINCEPSSEMIBOLD.TTF"); 
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.custom_image_button_with_text, this, true);
		fLayout = (FrameLayout) findViewById(R.id.frame_custom);
		textViewX = (TextView) findViewById(R.id.textview_x);
		textViewX.setTypeface(type); 
		textViewX.setTextSize(30);
	}

	public void setTextForButton(String text) {
		textViewX.setText(text);
	}
	
	public void setWidthForButton(int width) {
		LayoutParams lp = (LayoutParams) fLayout.getLayoutParams();
        lp.width = width;
        fLayout.setLayoutParams(lp);
	}
	
}
